<?php
include_once("include/include.php.inc");
html_header("Add Ticket");

/*   $backlink=getenv('HTTP_REFERER');*/

   import_request_variables("p","m_");
echo "<div class='box'>\n"; 
echo " <div class='boxtop'><div></div></div>\n"; 
echo "  <div class='boxcontent'>\n"; 
   if ($m_muname == "")
   {
      DIE("<center>UserName Cannot Be Blank</center>");
   }

   if (is_numeric($m_muname))
   {
      DIE("<center>UserName Cannot Be Numeric</center>");
   }
   
   if (empty($m_mproblem))
   {
   	  DIE("<center>Problem Cannot Be Blank</center>");
   }

      $client_ip = getenv('REMOTE_ADDR');
      $result = "INSERT INTO chd_tickets (tic_user, tic_date, tic_problem, tic_ip, tic_status, tic_time)VALUES(\"$m_muname\",CURDATE( ),\"$m_mproblem\",\"$client_ip\", 'O', CURTIME( ))";
      $action = mysql_query($result)
              OR DIE("Select Error:".mysql_error());
      $tic = mysql_insert_id();
/*               if (FALSE === ($action = mysql_query($result)))
              {
                  print mysql_error()."<br />";
                  print $result;
              }*/
   print "<center>Ticket Added Successfully.</center>";
   print "<br>";
   print "<center>Your Ticket# is :&nbsp;$tic </center>";
   print "<br>";
   print "<center><form method=\"post\" action=\"ticket_show.php\">";
   print "<input type=\"submit\" value=\" OK \"></form></center>";

echo "  </div>\n"; 
echo " <div class='boxbottom'><div></div></div>\n"; 
echo "</div>\n"; 
echo "\n";
   html_footer();
?>